﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using XtraLibrary.SecsGem;

namespace TestSecsDll
{
       public partial class Form1 : Form
    {
        public SecsIHost SIH;
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            SIH = new SecsIHost();
            SIH.Connect();
            SIH.EstablishCommunicationsRequest();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            SecsMessage sm = new SecsMessage(1, 13, true);
            /*sm.Items.Add(new SecsItemList("L0"));
            SIH.Send(sm);*/

            SecsItemList sil = new SecsItemList("L2");
           // sil.AddItem
            SecsItemList ih= new SecsItemList("L2");
            SecsItemAscii ih1=new SecsItemAscii("START", "START");
            SecsItemList ih2=new SecsItemList("L1");
            SecsItemList ih3 = new SecsItemList("L2");
            SecsItemAscii ih3_1 = new SecsItemAscii("CP-PORT", "CP-PORT");
            SecsItemAscii ih3_2 = new SecsItemAscii("1", "1");

            ih3.AddItem(ih3_1);
            ih3.AddItem(ih3_2);

            ih2.AddItem(ih3);

            ih.AddItem(ih1);
            ih.AddItem(ih2);

            sm.Items.Add(ih);
            SIH.Send(sm);
        }

        private void button3_Click(object sender, EventArgs e)
        {
           string  sRet= SIH.ReadPodID();
        }
    }
}
